package com.ruoyi.system.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.EcdStampingPlating;
import com.ruoyi.system.service.IEcdStampingPlatingService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 冲压电镀件Controller
 * 
 * @author ruoyi
 * @date 2025-11-09
 */
@RestController
@RequestMapping("/system/plating")
public class EcdStampingPlatingController extends BaseController
{
    @Autowired
    private IEcdStampingPlatingService ecdStampingPlatingService;

    /**
     * 查询冲压电镀件列表
     */
    @PreAuthorize("@ss.hasPermi('system:plating:list')")
    @GetMapping("/list")
    public TableDataInfo list(EcdStampingPlating ecdStampingPlating)
    {
        startPage();
        List<EcdStampingPlating> list = ecdStampingPlatingService.selectEcdStampingPlatingList(ecdStampingPlating);
        return getDataTable(list);
    }

    /**
     * 导出冲压电镀件列表
     */
    @PreAuthorize("@ss.hasPermi('system:plating:export')")
    @Log(title = "冲压电镀件", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, EcdStampingPlating ecdStampingPlating)
    {
        List<EcdStampingPlating> list = ecdStampingPlatingService.selectEcdStampingPlatingList(ecdStampingPlating);
        ExcelUtil<EcdStampingPlating> util = new ExcelUtil<EcdStampingPlating>(EcdStampingPlating.class);
        util.exportExcel(response, list, "冲压电镀件数据");
    }

    /**
     * 获取冲压电镀件详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:plating:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Integer id)
    {
        return success(ecdStampingPlatingService.selectEcdStampingPlatingById(id));
    }

    /**
     * 新增冲压电镀件
     */
    @PreAuthorize("@ss.hasPermi('system:plating:add')")
    @Log(title = "冲压电镀件", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody EcdStampingPlating ecdStampingPlating)
    {
        return toAjax(ecdStampingPlatingService.insertEcdStampingPlating(ecdStampingPlating));
    }

    /**
     * 修改冲压电镀件
     */
    @PreAuthorize("@ss.hasPermi('system:plating:edit')")
    @Log(title = "冲压电镀件", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody EcdStampingPlating ecdStampingPlating)
    {
        return toAjax(ecdStampingPlatingService.updateEcdStampingPlating(ecdStampingPlating));
    }

    /**
     * 删除冲压电镀件
     */
    @PreAuthorize("@ss.hasPermi('system:plating:remove')")
    @Log(title = "冲压电镀件", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Integer[] ids)
    {
        return toAjax(ecdStampingPlatingService.deleteEcdStampingPlatingByIds(ids));
    }
}
